package com.wedo.mall.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by lxy on 2017/6/18.
 */

public class AgentCategory implements Parcelable {

    /**
     * id : 49
     * category_name : eeeee
     * pid : 0
     * category_path :
     * app_icon : /Static/Uploads/Goods_pic/2017-06-27/800x800/5951baf89241c_800x800.png
     */

    public String id;
    public String category_name;
    public String pid;
    public String category_path;
    public String app_icon;

    /**以下字段非接口返回*/
    public boolean checked;
    public int more = -1;//更多分类

    @Override
    public String toString() {
        return id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AgentCategory)) return false;

        AgentCategory that = (AgentCategory) o;

        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.category_name);
        dest.writeString(this.pid);
        dest.writeString(this.category_path);
        dest.writeString(this.app_icon);
    }

    public AgentCategory() {
    }

    protected AgentCategory(Parcel in) {
        this.id = in.readString();
        this.category_name = in.readString();
        this.pid = in.readString();
        this.category_path = in.readString();
        this.app_icon = in.readString();
    }

    public static final Parcelable.Creator<AgentCategory> CREATOR = new Parcelable.Creator<AgentCategory>() {
        @Override
        public AgentCategory createFromParcel(Parcel source) {
            return new AgentCategory(source);
        }

        @Override
        public AgentCategory[] newArray(int size) {
            return new AgentCategory[size];
        }
    };
}
